package controller

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"strconv"
	"vueAdmin/application/logic"
	"vueAdmin/application/utils"
)

// 登录
func GetUserList(c *gin.Context) {
	defer utils.ErrHandle(c)
	username := c.DefaultQuery("username", "")
	realname := c.DefaultQuery("realname", "")
	pageNum, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
	pageSize, _ := strconv.Atoi(c.DefaultQuery("page", "15"))
	list := logic.GetUserList(username, realname, pageNum, pageSize)
	if len(list.List) == 0 {
		c.JSON(http.StatusOK, utils.SetPackageData(1100, list))
	} else {
		c.JSON(http.StatusOK, utils.SetPackageData(0, list))
	}

}
